<?php

namespace app\common\model;

use think\Db;
use think\Model;

/**
 * 审批 -- 报销
 */
class ApprovesReimburse extends Model
{

    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    // 追加属性
    protected $append = [

    ];

    public function getReimburseContentAttr($value)
    {
        if (!$value){
            return [];
        }
        $data = json_decode($value,true);
        foreach ($data as &$item){
            $attachments = explode(",",$item['attachment']);
            foreach ($attachments as $attachment){
                $item['attachment_arr'][] = $attachment ? cdnurl($attachment,true) : '';
            }
        }
        return $data;
    }

}
